package com.study.demo_wrapper;

import com.study.demo_wrapper.entities.TestEntity;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.convert.ConversionService;

@SpringBootApplication
public class DemoWrapperApplication {

	private static ConversionService conversionService;

	public DemoWrapperApplication(ConversionService conversionService) {
		DemoWrapperApplication.conversionService = conversionService;
	}

	public static void main(String[] args) {
		SpringApplication.run(DemoWrapperApplication.class, args);
		BeanWrapper beanWrapper=new BeanWrapperImpl(new TestEntity());
		beanWrapper.setPropertyValue("name","name");
		System.out.println(beanWrapper.getPropertyDescriptors());
		System.out.println(conversionService.canConvert(String.class, TestEntity.class));
		System.out.println(conversionService.convert("123", TestEntity.class));
	}

}
